//
//  Utils.h
//  Medical_Wisdom
//
//  Created by Mac on 14-1-26.
//  Copyright (c) 2014年 NanJingXianLang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>

/***************************************************************************
 *
 * 工具类
 *
 ***************************************************************************/

@class AppDelegate;
@class UserInfo;

@interface Utils : NSObject

/*
 AppDelegate
 */

+(AppDelegate *)applicationDelegate;

+ (UIImageView *)imageViewWithFrame:(CGRect)frame withImage:(UIImage *)image;

+ (UIImageView *)imageViewWithImage:(UIImage *)image;

+ (UILabel *)labelWithFrame:(CGRect)frame withTitle:(NSString *)title titleFontSize:(CGFloat )font textColor:(UIColor *)color backgroundColor:(UIColor *)bgColor alignment:(NSTextAlignment)textAlignment;

+ (UILabel *)labelWithTitle:(NSString *)title titleFontSize:(CGFloat )font textColor:(UIColor *)color backgroundColor:(UIColor *)bgColor alignment:(NSTextAlignment)textAlignment;

#pragma mark - btnCreate
+(UIButton *)createBtnWithType:(UIButtonType)btnType frame:(CGRect)btnFrame backgroundColor:(UIColor*)bgColor title:(NSString *)title image:(NSString *)image font:(CGFloat)font;

+(UIButton *)createBtnWithType:(UIButtonType)btnType backgroundColor:(UIColor*)bgColor title:(NSString *)title image:(NSString *)image font:(CGFloat)font;

/** 正则表达式邮箱判断 */
+(BOOL)isValidateEmail:(NSString *)email;

/** 正则表达式身份证号判断 */
+ (BOOL) validateIdentityCard: (NSString *)identityCard;

/** 正则表达式银行卡号判断 */
+ (BOOL) checkCardNo:(NSString*) cardNo;

/** 正则表达式手机号码判断 */
+ (BOOL)validatePhone:(NSString *)phone;

/** 空字符串的判断 */
+ (BOOL)isNull:(id)object;

/** md5加密 */
+ (NSString *)md5:(NSString *)str;

/**
 *  单个按钮(无响应)警告框
 *
 *  @param title   名字
 *  @param massage 信息
 *
 *  @return
 */
+(UIAlertController *)alertCreateTitle:(NSString *)title
                            andMassage:(NSString *)massage;

/**
 *  单个响应警告框
 *
 *  @param title      名字
 *  @param massage    信息
 *  @param enterTitle 响应按钮名字
 *  @param handler    响应事件
 *
 *  @return
 */
+(UIAlertController *)alertOneAcitonCreateTitle:(NSString *)title
                                     andMassage:(NSString *)massage
                             setActionEnterText:(NSString *)enterTitle
                                 setEnterAction:(void(^)(UIAlertAction * action))handler ;

/**
 *  两个按钮(一个有相应)警告框
 *
 *  @param title       名字
 *  @param massage     信息
 *  @param enterTitle  响应按钮名字
 *  @param cancelTitle 无响应按钮名字
 *  @param handler     响应事件
 *
 *  @return
 */
+(UIAlertController *)alertActionCreateTitle:(NSString *)title
                                  andMassage:(NSString *)massage
                          setActionEnterText:(NSString *)enterTitle
                         setActionCancelText:(NSString *)cancelTitle
                              setEnterAction:(void(^)(UIAlertAction * action))handler;

@end
